home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
trig
/
trig.bas
< prev
next >
Wrap
BASIC Source File
|
1995-05-09
|
3KB
|
133 lines
'This Module was prepared by
' Robert J. Gorman Jr.
' NATURESOFT
'
'and may be used free of charge to develop applications.
'All that I ask it that if you distribute this file please
'leave my name and this message on it and if you actually
'use it or any portion of it in developing your applications that you
'just drop me a note on American On-Line: RobertGJR
'or CompuServe: 75010,754.
'This is just the first and most simple in a series
'of Visual Basic modules I am preparing for scientific
'programmers. If there's anything you'd like to see
'drop me a note.
'
'If you're feeling really generous, PLEASE make a
'small DONATION to any group working to save the
'tropical rain forests. My personal favorites are
'programs educating children in tropical countries
'about the values of the rainforest.
'Look for additional products
'from NATURESOFT in the future.
Function Arccos (X)
'Calculates the Inverse Cosine of X
Arccos = Atn(X / Sqr(-X * X + 1)) + 1.5708
End Function
Function ArcCosec (X)
'Calculates the Inverse Cosecant of X
ArcCosec = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) * 1.5708
End Function
Function ArcCotan (X)
'Calculates the Inverse Cotangent of X
Arcotan = Atn(X) + 1.5708
End Function
Function ArcSec (X)
'Calculates the Inverse Secant of X
ArcSec = Atn(X / Sqr(X * X - 1)) + Sgn(Sgn(X) - 1) * 1.5708
End Function
Function Arcsin (X)
'Calculates the Inverse Sine of X
Arcsin = Atn(X / Sqr(-X * X + 1))
End Function
Function Cosec (X)
'Calculates the Cosecant of X
Cosec = 1 / Sin(X)
End Function
Function Cot (X)
'Calculates the Cotangent of X
Cot = 1 / Tan(X)
End Function
Function HArccos (X)
'Calculates the Inverse Hyperbolic Cosine of X
HArccos = Log(X + Sqr(X * X - 1))
End Function
Function HArccosec (X)
'Calculates the Inverse Hyperbolic Cosecant of X
HArccosec = Log((Sgn(X) * Sqr(X * X + 1) + 1) / X)
End Function
Function HArccotan (X)
'Calculates the Inverse Hyperbolic Cotangent of X
HArccotan = Log((X + 1) / (X - 1)) / 2
End Function
Function HArcsec (X)
'Calculates the Inverse Hyperbolic Secant of X
HArcsec = Log((Sqr(-X * X + 1) + 1) / X)
End Function
Function HArcsin (X)
'Calculates the Inverse Hyperbolic Sine of X
HArcsin = Log(X + Sqr(X * X + 1))
End Function
Function HArctan (X)
'Calculates the Inverse Hyperbolic Tangent of X
HArctan = Log((1 + X) / (1 - X)) / 2
End Function
Function Hcos (X)
'Calculates the Hyperbolic Cosine of X
Hcos = (Exp(X) + Exp(-X)) / 2
End Function
Function HCoSec (X)
'Caluclates the Hyperbolic Cosecant of X
HCoSec = 2 / (Exp(X) - Exp(-X))
End Function
Function HCotan (X)
'Calculates the Hyperbolic Cotangent of X
HCotan = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
End Function
Function HSec (X)
'Calculates the Hyperbolic Secant of X
HSec = 2 / (Exp(X) + Exp(-X))
End Function
Function Hsin (X)
'Calculates the Hyperbolic Sine of X
Hsin = (Exp(X) - Exp(-X)) / 2
End Function
Function HTan (X)
'Calculates the Hyperbolic HTan
HTan = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
End Function
Function LogN (X, N)
'Calculates the logarithm base N of X
LogN = Log(X) / Log(N)
End Function
Function Sec (X)
'Calculates the Secant of X
Sec = 1 / Cos(X)
End Function